{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[{'name': 'input_1', 'index': 0, 'shape': array([  1, 224, 224,   3], dtype=int32), 'shape_signature': array([  1, 224, 224,   3], dtype=int32), 'dtype': <class 'numpy.uint8'>, 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}]\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "import matplotlib.pylab as plt\n",
    "import cv2\n",
    "import numpy as np\n",
    "\n",
    "tflite_model_file = 'openpose_singlenet.tflite'\n",
    "\n",
    "interpreter = tf.lite.Interpreter(model_path=tflite_model_file)\n",
    "\n",
    "inp_index = interpreter.get_input_details()[0][\"index\"]\n",
    "\n",
    "out_details = sorted(interpreter.get_output_details(), key=lambda k: k['index']) \n",
    "\n",
    "heatmap_idx = out_details[-1][\"index\"]\n",
    "paf_idx = out_details[-2][\"index\"]\n",
    "\n",
    "print(interpreter.get_input_details())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Load sample image and run the model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_image = 'resources/ski_224.jpg'\n",
    "\n",
    "img = cv2.imread(test_image) # B,G,R order\n",
    "img = np.expand_dims(img, 0)\n",
    "\n",
    "input_tensor= tf.convert_to_tensor(img, np.uint8)\n",
    "\n",
    "interpreter.allocate_tensors()\n",
    "\n",
    "interpreter.set_tensor(inp_index, input_tensor)\n",
    "\n",
    "interpreter.invoke()\n",
    "\n",
    "heatmaps = interpreter.get_tensor(heatmap_idx)\n",
    "pafs = interpreter.get_tensor(paf_idx)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Show predictions: paf and heatmap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f1b044a7650>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAPmklEQVR4nO3dW4xd1X3H8d/PdjASBGGuconb0MgPRQVhhCygqKKqGhFeIA+pwguuGsl5CFUq9aEofQhQRUJVE1ShKshpUNwqJYrEVQLaIBSFPEU2N9vUaoGI+iqPgJYSc/PM/Psw29HEzFnr+Kyzzt7j9f1IozNz1tlnr9lnfrMva6+1HBECcOZb03cFAMwGYQcaQdiBRhB2oBGEHWjEulmuzDaX/nFGsJ0sP+uss5LlCwsLI8vm5+cnqtNJEbFi5YrCbvtmSf8gaa2kf4qI+3LLrFkz+cFEqpkw976lTYy5D3eo6y6Vq/uQt0vq/UuWlaT169cnyzdt2pQsf/fdd0eWvf3228llFxcXJyqbOHm210r6R0lfkHSFpNttXzHp+wGoq+Scfauk1yPilxHxsaQfSbp1OtUCMG0lYb9M0sFlPx/qnvsNtrfb3m17d8G6ABQqOWdf6aTnEyc6EbFD0g6JC3RAn0r27IckLb8K8RlJR8qqA6CWkrDvkrTZ9uW2z5L0ZUlPTqdaAKZt4sP4iJi3faekf9dS09tDEfFqbrlUk0dJM0/t3nsl71/azJMrX7du9MeYaooZpzwnV7dUk2jNZr2c0nVv3rw5Wf7KK68kyx9//PGRZXfccUdy2ePHjyfLRylqZ4+IpyU9XfIeAGaD22WBRhB2oBGEHWgEYQcaQdiBRhB2oBEz7c+eU7OtvKRrbU7trppr165Nlp9//vkjy3Jtsh988EGyvGZbd+732rBhQ7L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5TcMZRrvUdOMq+dt1/v05xEx8y9Jt2jpivwbkv6mjzqMqNfvSnql+3q177pJelhLh3UntHRE9BVJF0p6TtJr3eMFA6rbv2hpau89WgrWxp7qdqOWTg33SHq5+7ql722XqNdMthu3ywKN4A46oBGEHWgEYQcaQdiBRhB2oBGEHWgEYQca8f8jIzT1q/F8mQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "heatmap_idx = 0 # nose\n",
    "\n",
    "plt.imshow(heatmaps[0, :, :, heatmap_idx], cmap='gray')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f1b65280890>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAATNklEQVR4nO3db4id5ZkG8OtKTDT/k6NJNiRmrSWYDQs7yhAEl5K1bDHxg/ZDl/qhpCCbflBooeCKizQfZdm29MNSSNfQdOlaCq0oImtFAuqXkIlkNW7Y6kq2iY5OzfgniZlokns/zHEZ47z3dTzP+Uef6wdhZs4zz/s+5znvnTMz93s/DyMCZvanb8GwB2Bmg+FgN6uEg92sEg52s0o42M0qcdUgT9ZqtWLTpk19OXa/swokuz531rffLl++nLYvWJD/f6/GrtrV+YeldNyl83bp0qXGNnU9LVy4sLHt5MmTmJ6envfkRcFO8g4APwGwEMC/RsQj2fdv2rQJTz31VHa89HzZC6BeHDWBJRNcGuzqwlHHz/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N/ZzWxAHOxmlRhKsJO8g+R/k3yd5IPDGEMTkidIvkLyKMmJIY9lP8kpksfmPNYi+SzJ19of591jb0hj20vyzfbcHSW5a0hju57kQZLHSb5K8rvtx4c6d8m4BjJvA/+dneRCAL8H8LcATgE4DOCeiPivgQ6kAckTAMYjYug3YJD8CoCzAH4REX/ZfuyfAExHxCPt/yjXRMQ/jMjY9gI4O+xtvNu7FW2Yu804gLsBfBtDnLtkXH+HAczbMN7ZtwN4PSLeiIiPAfwKwF1DGMfIi4jnAVy59e1dAA60Pz+A2Ytl4BrGNhIiYjIiXmp/fgbAp9uMD3XuknENxDCCfSOAk3O+PoXR2u89APyO5BGSe4Y9mHmsj4hJYPbiAbBuyOO5ktzGe5Cu2GZ8ZOaum+3PSw0j2OdbYGuU8n+3RcQtAHYCuK/946p1pqNtvAdlnm3GR0K325+XGkawnwJw/ZyvNwF4awjjmFdEvNX+OAXgcYzeVtTvfLqDbvvj1JDH8/9GaRvv+bYZxwjM3TC3Px9GsB8GsIXkl0guBvBNAE8OYRyfQ3JZ+w8nILkMwNcweltRPwlgd/vz3QCeGOJYPmNUtvFu2mYcQ567oW9/HhED/wdgF2b/Iv8/AP5xGGNoGNeNAP6z/e/VYY8NwGOY/bHuE8z+RHQvgGsBPAfgtfbH1giN7d8AvALgZcwG1oYhje2vMfur4csAjrb/7Rr23CXjGsi8+XZZs0r4DjqzSjjYzSrhYDerhIPdrBIOdrNKONjNKuFgN6vE/wFMgt7TiqC1igAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "paf_dx_idx = 0\n",
    "paf_dy_idx = 1\n",
    "\n",
    "plt.imshow(pafs[0, :, :, paf_dx_idx], cmap='gray')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f1b652677d0>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAARBElEQVR4nO3dXYxd1XnG8efFX4BtqPmwa7DJl0ACVSoBy6oUVFFVtQhcmFxQxVeuEnUiEaRU6kURvQhSFQlVTSpfVBGTguJUKVEkQFgQtUEWCrkK2IgaU5fiWq49sbFBdsHGNsYzby9mOxrM7LWOz3vW3ses/0+yZuas2Xuvs+c8Ph/vXmuZuwvAZ99lfXcAQDcIO1AJwg5UgrADlSDsQCUWdnkwM+Ojf6Awd7f5bg+F3czukbRF0gJJ/+zuj+W2ueyy9hcTuTKg2bz3IbxtVLR8metbpO+Xcmk1d79L3rfcvqOPt8jfNLXt9PR0a9vQL+PNbIGkf5L0VUm3SdpkZrcNuz8AZUXes6+XtNfd97n7WUk/k7RxNN0CMGqRsN8o6eCcn6ea2z7BzCbMbIeZ7QgcC0BQ5D37fG8cPvVGxt0nJU1KfEAH9CnyzD4lae2cn9dIOhTrDoBSImF/VdLNZvYFM1ss6euSto2mWwBGbeiX8e5+zswekvTvmi29Penub+a2K1kCS4mWUhYsWNDalrtPMzMzyfboOUn1PXe/UqXQQbaPiJbWIn2LnvPceYuc11T5bJB9t7Eu67Bm5qnQRPoSvR+RsOfkwj7sH+88wt79sXPb9xX2mZmZ1otquFwWqARhBypB2IFKEHagEoQdqARhByrReektVbLoc0hjpPwVLdPkts+V7kpeAxCV2n/pay5K7j+67/vuu6+17YUXXkhumzqn7k7pDagdYQcqQdiBShB2oBKEHagEYQcq0XnpLTK7bPDYofaU0qPacn1Lld4uv/zy5LYnT55MtpcsK0bLgrm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s9OOtDCz/ZLWuXvvF2CY2R9LOinpJ+7+B81tfy/pmLs/1vxHucLd/2ZM+vaoLnIZ70J9a1tm/C/U47kb5fLnw+jjmX29pL3uvs/dz0r6maSNPfRj7Ln7y5KOXXDzRklbm++3avbB0rmWvo0Fdz/s7q8135+QdH6Z8V7PXaJfnegj7DdKOjjn5ymN13rvLumXZrbTzCb67sw8Vp1fZqv5urLn/lwou4x3ly5YZnxszt0wy59H9RH2+SbYGqf631fc/Q5JX5X07eblKgbzQ0lf0uwagIclfb/PzjTLjD8t6a/c/YM++zLXPP3q5Lz1EfYpSWvn/LxG0qEe+jEvdz/UfD0q6VmN31LUR86voNt8Pdpzf35nnJbxnm+ZcY3Buetz+fM+wv6qpJvN7AtmtljS1yVt66Efn2JmS5sPTmRmSyVt0PgtRb1N0ubm+82SnuuxL58wLst4ty0zrp7PXe/Ln7t75/8k3avZT+T/R9Lf9tGHln59UdJ/NP/e7Ltvkp7S7Mu6jzX7iuibkq6VtF3S283Xa8aob/+i2aW9d2k2WKt76ttdmn1ruEvS682/e/s+d4l+dXLeuFwWqARX0AGVIOxAJQg7UAnCDlSCsAOVIOxAJQg7UIn/B9br6ptke9c1AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(pafs[0, :, :, paf_dy_idx], cmap='gray')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
